﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Shipment : Form
    {
        Controller cont;
        public Shipment()
        {
            cont = new Controller();
            InitializeComponent();

        }

        private void btn_add_Click(object sender, EventArgs e)
        {
            string ans = cont.StockUpdate(Convert.ToInt32(txt_num.Text), Convert.ToInt32(txt_prod.Text), Convert.ToInt32(txt_amount.Text), date_rec.Value, date_exp.Value);
            if (ans == "code")
            {
                MessageBox.Show("קוד מוצר שגוי");
            }
            else if (ans == "amount")
            {
                MessageBox.Show("הכמות לא תואמת להזמנה");
            }
            else if (ans == "ok")
            {
                MessageBox.Show("בוצע");
                txt_prod.Clear();
                txt_num.Clear();
                txt_amount.Clear();
            }
        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            txt_prod.Clear();
            txt_num.Clear();
            txt_amount.Clear();
        }
    }
}
